You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(quota): reject out-of-range reset times - #9033
bun test test/quota.test.ts (pm-stack/aggregator): 31 pass.
git diff --check: pass.
Full aggregator suite attempted; environment lacks web-push in this worktree and unrelated tests failed/timed out.
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by CodeRabbit
Bug Fixes
Invalid quota reset times are now rejected, including hours above 23 and minutes above 59. Valid reset times, including 23:59, continue to produce the expected UTC reset timestamp.
Month-based quota resets now handle month names regardless of capitalization and reject invalid month names or dates.
No actionable comments were generated in the recent review.
Walkthrough
The monthly quota reset parser now rejects non-integer or out-of-range hours and minutes. Tests cover valid and invalid reset times across ChatGPT, OpenCode Go, and Command Code.
Changes: Quota reset time validation
Layer / File(s)
Summary
Validate monthly reset times pm-stack/aggregator/src/quota-extract.ts, pm-stack/aggregator/test/quota.test.ts
monthDayTime returns null for invalid hours or minutes. Tests cover out-of-range values, the valid 23:59 boundary, and existing quota windows across the three consumers.
Quota reset times with out-of-range hours or minutes are now rejected instead of being silently rolled into a different time. Valid times are unchanged, and no merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "fix(quota): reject out-of-range reset times" names the main change. The raw summary and objectives confirm that monthDayTime now returns null for hours above 23 or minutes above 59, with re…
Linked Issues check
Issue #9003 requires monthDayTime to return null for out-of-range time-of-day values (hour > 23 or minute > 59) at all three call sites (Codex, OpenCode Go, Command Code), while keeping the window per…
Out of Scope Changes check
Both changed files are in scope. The source change is a single validation guard inside monthDayTime, which is the function named in #9003. No other extractor logic or parsing regex is modified. The te…
Full details: Title check
Explanation
The title "fix(quota): reject out-of-range reset times" names the main change. The raw summary and objectives confirm that monthDayTime now returns null for hours above 23 or minutes above 59, with regression tests for those cases. The title is specific and short, and it matches the changeset.
Full details: Linked Issues check
Explanation
Issue #9003 requires monthDayTime to return null for out-of-range time-of-day values (hour > 23 or minute > 59) at all three call sites (Codex, OpenCode Go, Command Code), while keeping the window percentage and other fields. The diff adds one guard in monthDayTime in pm-stack/aggregator/src/quota-extract.ts, after the hh:mm split and before Date.UTC: if (!Number.isInteger(h) || h < 0 || h > 23 || !Number.isInteger(m) || m < 0 || m > 59) return null;. Because all three extractors call this shared function, the guard covers each call site. The guard runs before the date construction, so minute 60 and 99 (no midnight rollover) and hour 24 are rejected directly, not only by the day-roll side effect. Regression tests in pm-stack/aggregator/test/quota.test.ts run the existing three-consumer matrix and add cases for 18:60 (null), 18:99 (null), 24:00 (null), and 23:59 (expected 2026-10-30T23:59:00.000Z). The existing month-case, Foo 30, and Oct 39 cases remain in the matrix, and the 18:01 control is kept. The issue's acceptance criteria are covered by this change.
Full details: Out of Scope Changes check
Explanation
Both changed files are in scope. The source change is a single validation guard inside monthDayTime, which is the function named in #9003. No other extractor logic or parsing regex is modified. The test changes parameterize the existing consumer matrix with a time field and add the invalid and boundary time cases required by #9003. The test file diff contains no unrelated changes. The guard is only a validation addition, so the valid-time, month-case, unknown-month, out-of-range-day, and roll-forward paths are unchanged in behavior. Existing test results are taken from the PR description; this assessment did not run the tests.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 96f84231-ef36-4bed-aeff-f3e389290281
Commits
Reviewing files that changed from the base of the PR and between 8064969 and 9b9c5cb.
Files selected for processing: 2
pm-stack/aggregator/src/quota-extract.ts
pm-stack/aggregator/test/quota.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #9003
Verification
bun test test/quota.test.ts(pm-stack/aggregator): 31 pass.git diff --check: pass.web-pushin this worktree and unrelated tests failed/timed out.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit